<META content="text/html; charset=UTF-8" http-equiv=Content-Type>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>bitshe</title>
</head>
<body>
<?php
$adminpassword="bitsighup1019";
$verification=false;
$onlinecode="";
if (isset($_POST["pass"])){
    if($adminpassword==$_POST["pass"]){
        $onlinecode=crypt($_SERVER["REMOTE_ADDR"] . "我爱加密啦啦啦啦","yteas6+231s");
        $wj_onlinecode=fopen("#onlinecode","w+") or exit("Error");
        fwrite($wj_onlinecode, $onlinecode,strlen($onlinecode));
        fclose($wj_onlinecode);
        $verification=true;
        $expire=time()+60*60*24*30;
        setcookie("admin", $onlinecode, $expire);
    }else $verification=false;
}else if (isset($_COOKIE["admin"])){
    $wj_onlinecode=fopen("#onlinecode","r") or exit("Error");
    $onlinecode=fread($wj_onlinecode, filesize("#onlinecode"));
    fclose($wj_onlinecode);
    if ($onlinecode==$_COOKIE["admin"])
        $verification=true;
        else $verification=false;
}else $verification=false;


    if ($verification==true){
        

$db=new mysqli('localhost','root','8japNWTQaTCcS7BP','bitshebm');
if(mysqli_connect_errno($db)){
    echo mysqli_connect_error();
    exit;
}
mysqli_query($db, "SET NAMES UTF8");
$result=mysqli_query($db,"SELECT *  FROM `bitshebm`.`社团招新-201810`");

echo '<table width="1300" border="1" cellspacing="0" cellpadding="1"><tbody>
<tr>
<th scope="col">序号</th>
<th scope="col">姓名</th>
<th scope="col">学号</th>
<th scope="col">院系</th>
<th scope="col">班级</th>
<th scope="col">QQ</th>
<th scope="col">电话</th>
<th scope="col">擅长</th>
<th scope="col">期待</th>
<th scope="col">报名日期</th>
<th scope="col">报名端IP</th>
<th scope="col">报名端特征</th>
</tr>';

while (list($id,$name,$no,$depart,$class,$qq,$tel,$skill,$expect,$bmdate,$vaip,$vafeature)=mysqli_fetch_row($result)){

    echo "<tr>
	<td>" . $id . "</td>
	<td>" . $name . "</td>
	<td>" . $no . "</td>
	<td>" .$depart . "</td>
	<td>" . $class . "</td>
	<td>" . $qq ."</td>
	<td>" . $tel . "</td>
	<td>" . $skill ."</td>
	<td>" . $expect ."</td>
	<td>" .$bmdate . "</td>
	<td>" . $vaip . "</td>
	<td>" . $vafeature . "</td>
	</tr>";
}
echo "</tbody></table>";
       }else {
         echo '<form action="admin.php" method="post">' ;
         echo ' adminpassword: <input type="text" name="pass">';
         echo ' <input type="submit" value="提交">';
         echo '</form>';
       }
?>
</body>
</html>